<style scoped lang="less">

  .item{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2vw;
    background-color: white;
    border-bottom: #f4f4f4 1px solid;
  }
  .item-img{
    width: 8vw;
    height: 8vw;
    border-radius: 50%;
  }
  .item-content{
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .item-date{
    color: @--gray;
    font-size: 0.3rem;
  }
  .item-nickname{
    color: @--black;
    font-size: 0.4rem;
    padding-left: 2vw;
  }
</style>
<template>
  <div class="contaienr">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad">
      <div class="item" v-for="item in list" :key="item.uid">
        <van-image class="item-img" :src="item.wxUserInfo.head_img"></van-image>
        <div class="item-content">
          <span class="item-date">{{item.create_time.substr(0,10)}}</span>
          <span class="item-nickname">{{item.wxUserInfo.nickname}}</span>
        </div>
      </div>
    </van-list>
  </div>
</template>
<script>
  import {getMyDistribution} from '@/api/spread';
  import Vue from 'vue';
  import {List,Image} from 'vant';

  Vue.use(List).use(Image);
  export default {
    name: 'distribution',
    data() {
      return {
        list: [],
        count: -1,
        loading: false,
        finished: false,
        page_size: 20
      };
    },
    created() {
    },
    methods: {
      onLoad() {
        let vm = this;
        if (vm.finished) {
          return;
        }
        getMyDistribution().then(rep => {
          vm.loading = false;
          if (rep.data.data.list === null || rep.data.data.list.length === 0) {
            vm.finished = true;
          } else {
            vm.list = vm.list.concat(rep.data.data.list);
            if (rep.data.data.count === vm.list.length) {
              vm.finished = true;
            }
          }
        }, error => {
          vm.loading = false;
          vm.finished = true;
        });
      }
    }
  }
</script>